<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的设计展示-ZoomYoung</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1, minimum-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.min.css">
<link rel="stylesheet" type="text/css" href="http://file.zoomyoung.cn/web/css/all.css">
<link rel="stylesheet" type="text/css" href="http://file.zoomyoung.cn/web/css/show.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/js/swiper.min.js"></script>
<script type="text/javascript" src="http://file.zoomyoung.cn/web/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="http://file.zoomyoung.cn/web/js/ajax/ajaxFeng.js"></script>
<script type="text/javascript" src="https://unpkg.com/better-scroll/dist/bscroll.min.js"></script>
</head>
<body>
    <div class="aa wrapper" style="width: 100%;height: 100%;">
            <div class="content">
                <img src="http://file.zoomyoung.cn/web/img/background.jpg" class="background"/>
                <a class="nav_tiao" href="./design.html"><img src="http://file.zoomyoung.cn/web/img/ui/tiao.png"/></a>
                <div class="nav_sex"><img src="http://file.zoomyoung.cn/web/img/ui/nan.png"/></div>
               <!--人物切换-->
                <div class="nav_people">

                    <div class="swiper-container bb">
                    <div class="swiper-wrapper">
                    </div>
                    <div class="swiper-button-prev"></div>
                    <div class="swiper-button-next"></div>

                    </div>
                </div>
               <!--选中人物-->
                <div class="nav">
                <div class="nav_position">
                   <img src="img/buy/navBack.png" class="navBack"/>
                   <ul>
                   </ul>
                   </div>
                </div>
                <img src="http://file.zoomyoung.cn/web/img/001.jpg" class="background"/>
                <img src="http://file.zoomyoung.cn/web/img/002.jpg" class="background"/>
                <img src="http://file.zoomyoung.cn/web/img/003.jpg" class="background"/>
                <img src="http://file.zoomyoung.cn/web/img/004.jpg" class="background"/>
                <img src="http://file.zoomyoung.cn/web/img/005.jpg" class="background"/>
            </div>

        <div class="nav_buyHost">
            <a class="nav_buy">
               <img src="http://file.zoomyoung.cn/web/img/btn_buy.png"/>
            </a>
            <span class="nav_time" style="color: white"></span>
        </div>
      </div>
    </div>
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?2a04b9d7f4b4a0edfe491497d0cfa626";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
    <script>
    $(function(){
      let scroll = new BScroll('.wrapper',{
      scrollY: true,
      click: true
      })
    }) 
      var search=window.location.search;
      var code=search.substr(6)
      var $a='?code='+code
      var data=$.doGetDataAjax('http://zoomyoung.cn/api/design/get-build-by-code',"json",false,$a);
      console.log(data)
      for(var i=0;i<data.data.imgs.length;i++)
      {
         $('.swiper-wrapper').append('<div class="swiper-slide"><img src="'+data.data.imgs[i].img_url+'"/></div>')
         $('.nav_position ul').append('<li><img src="'+data.data.imgs[i].thumb_img_url+'"/></li>')
      }
     $('.nav_position ul li').eq(0).addClass('select');
    var swiper2 = new Swiper('.bb', {
        direction: 'horizontal',     
        roundLengths : true,
         navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
      observer:true,//修改swiper自己或子元素时，自动初始化swiper
    observeParents:true,//修改swiper的父元素时，自动初始化swiper
    },
    on:{
    slideChangeTransitionStart: function(event){
      var index=swiper2.activeIndex;
      $('.nav ul li').eq(index).find('img').addClass('select').parent('li').siblings().find('img').removeClass('select')
    }
  }
    })
   /*轮播图上的人物切换*/
   $('.nav ul li').eq(0).find('img').addClass('select')
    $('.nav ul li').click(function(){
        var index=$(this).index();
        $(this).find('img').addClass('select').parent('li').siblings().find('img').removeClass('select');
        swiper2.slideTo(index,500,false);
    })
    $('.background1').eq(0).css('marginTop',$('.navBack').height())
   /*男女模按钮的切换
    var sex=1;
    $('.nav_sex img').click(function(){
        if(sex==1)
        {
            $(this).attr('src','img/buy/button/nv.png');
            sex=0;
        }
        else
        {
             $(this).attr('src','img/buy/button/nan.png');
             sex=1;
        }
       
    }) */


    //获取活动时间
    var dataTime=$.doGetDataAjax('http://zoomyoung.cn/api/design/is-in-active','json',false,"")
    var total=parseInt(dataTime.data.time_init);
    console.log(dataTime)
    if(dataTime.data.is_action==1)
    {
      $('.nav_buy img').attr('src','http://file.zoomyoung.cn/web/img/btn_active.png')
      timeSever(total)
      setInterval(function () {
        total-=1;
        timeSever(total)
    }, 1000);
    }else{
      $('.nav_buy img').attr('src','http://file.zoomyoung.cn/web/img/btn_buy.png')
      $('.nav_time').html("")
    }
    //用来把秒数转换成时间格式
    function timeSever(total){
      var hour = parseInt(total  / 60 / 60 % 24) < 10 ?'0' + parseInt(total  / 60 / 60 % 24) : parseInt(total  / 60 / 60 % 24);
      var minute = parseInt(total  / 60 % 60< 10 ?'0' + parseInt(total  / 60 % 60) : parseInt(total  / 60 % 60));
      var seconds = parseInt(total  % 60)< 10 ?'0'+ parseInt(total  % 60) : parseInt(total  % 60);
      $('.nav_time').html("活动倒计时 "+hour + ":" + minute + ":" + seconds);
    }

      //点击按钮的时候跳转
      $('.nav_buy').click(function(){
         $a=$a+"&is_action="+dataTime.data.is_action;     //为了把判断是否为活动期的参数带过去
        window.location.href="./information.html"+$a;
        return false
    })
    </script>
</body></html>